<template>
	<view class="page" :style="themeColor">
		<view
			class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex changeBingDingPhone_flex_0"
			:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class='flex flex-wrap align-stretch justify-between changeBingDingPhone_fd0_0'>
				<view class='flex flex-wrap align-center changeBingDingPhone_fd0_0_c0' @tap.stop="handleJumpDiy"
					data-type="back" data-url="1">
					<text class='fu-iconfont2  changeBingDingPhone_fd0_0_c0_c0'>&#xe794;</text>
				</view>
				<view class='flex flex-wrap align-center'>
					<text class='changeBingDingPhone_fd0_0_c1_c0'>修改绑定手机号</text>
				</view>
				<view class='flex align-center justify-end changeBingDingPhone_fd0_0_c2'>
				</view>
			</view>

		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

		<view class="flex flex-direction align-center benben-flex-layout changeBingDingPhone_flex_1">
			<text class='changeBingDingPhone_fd1_0'>我们要对您绑定的手机号进行验证：</text>
			<text class='changeBingDingPhone_fd1_1'>{{dataDetails.mobile_hide}}</text>
		</view>

		<benben-digital-password v-model='code' :box-num='6' mode='number'
			class-name='flex flex align-center justify-center changeBingDingPhone_flex_password_2'>
			<template #default="{ content, active, index }">
				<view :key="index" v-if="active"
					class="flex align-center justify-center active-digital-password changeBingDingPhone_flex_password_active_2">
					{{ content }}
				</view>
				<view :key="index" v-else
					class="flex align-center justify-center changeBingDingPhone_flex_password_noActive_2">
					{{ content }}
				</view>
			</template>
		</benben-digital-password>
		<!---flex布局flex布局开始-->
		<view class="flex flex-direction flex-wrap align-stretch justify-center benben-flex-layout">
			<view class='flex flex-wrap align-center justify-center'>
				<benben-send-verification-code class='flex  changeBingDingPhone_fd3_0_c0' after-text='后重新获取'
					before-text='获取验证码' type='7' :phone="dataDetails.mobile"></benben-send-verification-code>
			</view>
			<button class='changeBingDingPhone_fd3_1' @tap.stop="checkCodeFunc()">下一步</button>
		</view>
		<!---flex布局flex布局结束-->


	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'
	export default {
		components: {},


		data() {
			return {
				"mobile": "15636956658",
				"code": "",
				"dataDetails": {
					"invite_code": "",
					"address": "",
					"address_code": "",
					"address_citycode": "",
					"id": "",
					"lastid": "",
					"user_nickname": "",
					"mobile": "",
					"user_name": "",
					"head_img": "",
					"birthday": "",
					"is_finger": "",
					"user_money": "",
					"freeze_money": "",
					"withdrawal_money": "",
					"score": "",
					"empirical": "",
					"invoice_title": "",
					"invoice_company_title": "",
					"total_consumption_money": "",
					"sex": "",
					"create_time": "",
					"phone": "",
					"online": "",
					"_mobile": "",
					"coupon": "",
					"age": "",
					"collection_count": "",
					"browse_count": "",
					"certified": "",
					"invite": []
				}
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},
			userInfo: {
				get() {
					return this.$store.state.userInfo
				},
				set() {
					this.$store.commit('updateUserInfo', value)
				},
			}
		},
		watch: {},
		onLoad(options) {
			this.DataDetailsFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//校验验证码
			checkCodeFunc() {
				if (!validate(this.code, 'require')) {
					this.$message.info('请输入验证码');
					return false;
				}
				if (!validate(this.code, 'captcha')) {
					this.$message.info('请输入正确的验证码');
					return false;
				}
				if (!validate(this.code, 'length', '6')) {
					this.$message.info('请输入6位验证码');
					return false;
				}
				this.$api.post(global.apiUrls.post643673025ef00, {
					mobile: this.dataDetails.mobile,
					code: this.code,
					type: 7
				}).then(res => {
					if (res.data.code == 1) {
						uni.redirectTo({
							url: '/pages/xtsz/inputNewPhone/inputNewPhone'
						})
					} else {
						this.$message.info(res.data.msg);
					}
				})
			},
			//获取会员信息
			async DataDetailsFunc() {
				//请求方法
				//数据验证

				let datadataDetails = await this.$api.post(global.apiUrls.post64366f0e3b620, {
					user_id: this.userInfo.id
				});
				if (datadataDetails.data.code != 1) {
					this.$message.info(datadataDetails.data.msg);
					return
				}
				let infodataDetails = datadataDetails.data;
				this.dataDetails = infodataDetails.data
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto !important;
	}

	.changeBingDingPhone_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.changeBingDingPhone_fd0_0_c2 {
		padding: 0rpx 0rpx 0rpx 0rpx;
		width: 100rpx;
	}

	.changeBingDingPhone_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.changeBingDingPhone_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 400;
		color: #333;
	}

	.changeBingDingPhone_fd0_0_c0 {
		width: 100rpx;
	}

	.changeBingDingPhone_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.changeBingDingPhone_flex_1 {
		padding: 103rpx 0rpx 0rpx 0rpx;
	}

	.changeBingDingPhone_fd1_1 {
		margin: 51rpx 0rpx 40rpx 0rpx;
		line-height: 37rpx;
		font-size: 32rpx;
		font-weight: 500;
		color: #333333;
	}

	.changeBingDingPhone_fd1_0 {
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.changeBingDingPhone_flex_password_noActive_2 {
		border: 1px solid #eee;
		width: 100rpx;
		height: 100rpx;
	}

	.changeBingDingPhone_flex_password_active_2 {
		border: 1px solid #eee;
		width: 100rpx;
		height: 100rpx;
	}

	::v-deep .changeBingDingPhone_flex_password_2 {
		margin: 24rpx 0rpx 24rpx 0rpx;
	}

	.changeBingDingPhone_fd3_1 {
		background: rgba(62, 128, 246, 1);
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		font-size: 32rpx;
		color: #fff;
		margin: 80rpx 32rpx 0rpx 32rpx;
		height: 88rpx;
		line-height: 88rpx;
		width: 686rpx;
	}

	.changeBingDingPhone_fd3_0_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(59, 157, 255, 1);
		text-align: center;
	}
</style>